package com.kosam.demoservice.service.impl;

import com.kosam.commons.base.service.ServiceSupportImpl;
import com.kosam.demoservice.entity.User;
import com.kosam.demoservice.repository.UserRepository;
import com.kosam.demoservice.service.UserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * Created by tgx on 2017/2/15.
 */
@Service
@Transactional(readOnly = true)
public class UserServiceImpl extends ServiceSupportImpl<User, Long> implements UserService {

    private Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    private UserRepository userRepository;

    @Override
    public User findByName(String name) {
        return userRepository.findByName(name);
    }

    @Override
    public Page<User> query(Pageable pageable, String name) {
        return userRepository.query(pageable, name);
    }
}
